package com.yogee.topseller.activity.tianyan;

import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.yogee.core.http.listener.HttpOnNextListener;
import com.yogee.core.http.subscribers.BaseSubscriber;
import com.yogee.core.utils.ToastUtils;
import com.yogee.topseller.R;
import com.yogee.topseller.activity.base.HttpActivity;
import com.yogee.topseller.adapter.BzxrAdapter;
import com.yogee.topseller.adapter.GbbdAdapter;
import com.yogee.topseller.adapter.GbjgAdapter;
import com.yogee.topseller.adapter.GpfhAdapter;
import com.yogee.topseller.adapter.GqczDetailAdapter;
import com.yogee.topseller.adapter.SxrAdapter;
import com.yogee.topseller.adapter.YzwfAdapter;
import com.yogee.topseller.bean.BzxrBean;
import com.yogee.topseller.bean.GbbdBean;
import com.yogee.topseller.bean.GbjgBean;
import com.yogee.topseller.bean.GpfhBean;
import com.yogee.topseller.bean.GqczBean;
import com.yogee.topseller.bean.SxrBean;
import com.yogee.topseller.bean.YzwfBean;
import com.yogee.topseller.http.HttpManager;
import com.yogee.topseller.layout.TitleLayout;
import com.yogee.topseller.utils.AppUtil;
import com.yogee.topseller.utils.Constants;
import com.yogee.topseller.view.FullyLinearLayoutManager;

import java.text.SimpleDateFormat;
import java.util.Date;

import butterknife.BindView;

public class GqczDetailActivity extends HttpActivity {

    @BindView(R.id.add_card_titlelayout)
    TitleLayout titlelayout;
    @BindView(R.id.tv_title)
    TextView tv_title;
    @BindView(R.id.tv_value1)
    TextView tv_value1;
    @BindView(R.id.tv_value2)
    TextView tv_value2;
    @BindView(R.id.tv_value3)
    TextView tv_value3;
    @BindView(R.id.tv_value4)
    TextView tv_value4;
    @BindView(R.id.tv_value5)
    TextView tv_value5;
    @BindView(R.id.tv_value6)
    TextView tv_value6;
    @BindView(R.id.tv_value7)
    TextView tv_value7;
    @BindView(R.id.tv_value8)
    TextView tv_value8;
    @BindView(R.id.tv_value9)
    TextView tv_value9;
    @BindView(R.id.tv_value10)
    TextView tv_value10;
    @BindView(R.id.tv_value11)
    TextView tv_value11;
    @BindView(R.id.ll1)
    LinearLayout ll1;
    @BindView(R.id.rv_gongsi)
    RecyclerView rv_gongsi;
    GqczDetailAdapter adapter = null;
    GqczBean.Item bean = null;

    @Override
    protected int getLayoutId() {
        return R.layout.activity_detail_gqcz;
    }

    @Override
    protected void initView() {
        titlelayout.setActivity(this);
        titlelayout.setTitle(getIntent().getStringExtra("title"));
        bean = (GqczBean.Item) getIntent().getSerializableExtra("info");
        rv_gongsi.setLayoutManager(new FullyLinearLayoutManager(this));
        adapter = new GqczDetailAdapter(this);
        rv_gongsi.setAdapter(adapter);
        setInfo();
    }
    private void setInfo(){
        if(bean!=null){
            SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");

            tv_title.setText(bean.getPledgee());
            tv_value1.setText(bean.getEquityAmount());
            tv_value2.setText(bean.getEquityAmount());
            tv_value3.setText(bean.getRegNumber().trim());
            tv_value4.setText(sdf.format(new Date(Long.parseLong(String.valueOf(bean.getPutDate())))));

            tv_value6.setText(sdf.format(new Date(Long.parseLong(String.valueOf(bean.getRegDate())))));
            tv_value7.setText(bean.getState());
            tv_value8.setText(bean.getBase());
            tv_value9.setText(bean.getPledgor());
            tv_value10.setText(bean.getCertifNumberR());
            tv_value11.setText(bean.getCertifNumber());
            if(bean.getCompanyList()!=null&&bean.getCompanyList().size()>0){
                adapter.addData(bean.getCompanyList());
            }else{
                ll1.setVisibility(View.GONE);
            }

        }
    }

}
